#pragma once 

#if (_MFC_VER < 0x0700)

#ifdef _AFXDLL
#define BEGIN_MESSAGE_MAP_TEMPLATE1(theClass) \
	template <class T> \
	const AFX_MSGMAP* PASCAL theClass<T>::_GetBaseMessageMap() \
		{ return &T::messageMap; } \
	template <class T> \
	const AFX_MSGMAP* theClass<T>::GetMessageMap() const \
		{ return &theClass<T>::messageMap; } \
	template <class T> \
	AFX_COMDAT AFX_DATADEF const AFX_MSGMAP theClass<T>::messageMap = \
	{ &theClass<T>::_GetBaseMessageMap, &theClass<T>::_messageEntries[0] }; \
	template <class T> \
	AFX_COMDAT const AFX_MSGMAP_ENTRY theClass<T>::_messageEntries[] = \
	{ \

#else

#define BEGIN_MESSAGE_MAP_TEMPLATE1(theClass) \
	template <class T> \
	const AFX_MSGMAP* theClass<T>::GetMessageMap() const \
		{ return &theClass::messageMap; } \
	template <class T> \
	AFX_COMDAT AFX_DATADEF const AFX_MSGMAP theClass<T>::messageMap = \
	{ &T::messageMap, &theClass<T>::_messageEntries[0] }; \
	template <class T> \
	AFX_COMDAT const AFX_MSGMAP_ENTRY theClass<T>::_messageEntries[] = \
	{ \

#endif

#ifdef _AFXDLL
#define BEGIN_MESSAGE_MAP_TEMPLATE2(theClass, theBase) \
	template <class T> \
	const AFX_MSGMAP* PASCAL theClass<T>::_GetBaseMessageMap() \
		{ return &theBase<T>::messageMap; } \
	template <class T> \
	const AFX_MSGMAP* theClass<T>::GetMessageMap() const \
		{ return &theClass<T>::messageMap; } \
	template <class T> \
	AFX_COMDAT AFX_DATADEF const AFX_MSGMAP theClass<T>::messageMap = \
	{ &theClass<T>::_GetBaseMessageMap, &theClass<T>::_messageEntries[0] }; \
	template <class T> \
	AFX_COMDAT const AFX_MSGMAP_ENTRY theClass<T>::_messageEntries[] = \
	{ \

#else
#define BEGIN_MESSAGE_MAP_TEMPLATE2(theClass, theBase) \
	template <class T> \
	const AFX_MSGMAP* theClass<T>::GetMessageMap() const \
		{ return &theClass::messageMap; } \
	template <class T> \
	AFX_COMDAT AFX_DATADEF const AFX_MSGMAP theClass<T>::messageMap = \
	{ &theBase<T>::messageMap, &theClass<T>::_messageEntries[0] }; \
	template <class T> \
	AFX_COMDAT const AFX_MSGMAP_ENTRY theClass<T>::_messageEntries[] = \
	{ \

#endif

#else // _MFC_VER < 0x0700

#ifdef _AFXDLL
#define BEGIN_MESSAGE_MAP_TEMPLATE1(theClass) \
	template <class T> \
	const AFX_MSGMAP* PASCAL theClass<T>::GetThisMessageMap() \
		{ return &theClass::messageMap; } \
	template <class T> \
	const AFX_MSGMAP* theClass<T>::GetMessageMap() const \
		{ return &theClass::messageMap; } \
	template <class T> \
	AFX_COMDAT const AFX_MSGMAP theClass<T>::messageMap = \
	{ &T::GetThisMessageMap, &theClass<T>::_messageEntries[0] }; \
	template <class T> \
	AFX_COMDAT const AFX_MSGMAP_ENTRY theClass<T>::_messageEntries[] = \
	{ \

#else
#define BEGIN_MESSAGE_MAP_TEMPLATE1(theClass) \
	template <class T> \
	const AFX_MSGMAP* theClass<T>::GetMessageMap() const \
		{ return &theClass<T>::messageMap; } \
	template <class T> \
	AFX_COMDAT const AFX_MSGMAP theClass<T>::messageMap = \
	{ &T::messageMap, &theClass::_messageEntries[0] }; \
	template <class T> \
	AFX_COMDAT const AFX_MSGMAP_ENTRY theClass<T>::_messageEntries[] = \
	{ \

#endif

#ifdef _AFXDLL
#define BEGIN_MESSAGE_MAP_TEMPLATE2(theClass, baseClass) \
	template <class T> \
	const AFX_MSGMAP* PASCAL theClass<T>::GetThisMessageMap() \
		{ return &theClass::messageMap; } \
	template <class T> \
	const AFX_MSGMAP* theClass<T>::GetMessageMap() const \
		{ return &theClass::messageMap; } \
	template <class T> \
	AFX_COMDAT const AFX_MSGMAP theClass<T>::messageMap = \
	{ &baseClass<T>::GetThisMessageMap, &theClass<T>::_messageEntries[0] }; \
	template <class T> \
	AFX_COMDAT const AFX_MSGMAP_ENTRY theClass<T>::_messageEntries[] = \
	{ \

#else
#define BEGIN_MESSAGE_MAP_TEMPLATE2(theClass, baseClass) \
	template <class T> \
	const AFX_MSGMAP* theClass<T>::GetMessageMap() const \
		{ return &theClass<T>::messageMap; } \
	template <class T> \
	AFX_COMDAT const AFX_MSGMAP theClass<T>::messageMap = \
	{ &baseClass<T>::messageMap, &theClass::_messageEntries[0] }; \
	template <class T> \
	AFX_COMDAT const AFX_MSGMAP_ENTRY theClass<T>::_messageEntries[] = \
	{ \

#endif

#endif